#ifndef RDPCLIENT_H
#define RDPCLIENT_H

#include "protocol.h"
#include <QImage>
#include <QPoint>
#include <Qt>

// RDP客户端前置声明
class RdpInstance;

class RdpClient : public Protocol
{
    Q_OBJECT

public:
    explicit RdpClient(QObject *parent = nullptr);
    ~RdpClient();

    // 实现协议接口
    bool connectToHost(const QString &host, int port, const QString &password) override;
    void disconnectFromHost() override;
    QImage getDesktopImage() const override;
    void sendMouseEvent(const QPoint &pos, Qt::MouseButton button, bool pressed) override;
    void sendKeyEvent(int key, bool pressed) override;
    void sendText(const QString &text) override;
    void requestFrame(const QRect &region) override;
    QStringList supportedFeatures() const override;
    bool hasFeature(const QString &feature) const override;

private slots:
    void onConnected();
    void onDisconnected();
    void onError(const QString &error);
    void onFrameUpdated();

private:
    RdpInstance *rdpInstance;
    
    // RDP设置
    QString domain;
    QString username;
    int colorDepth;
    
    // 桌面信息
    int desktopWidth;
    int desktopHeight;
    QImage framebuffer;
    
    // 初始化连接
    void initializeConnection();
    
    // 设置RDP参数
    void configureRdpSettings();
};

#endif // RDPCLIENT_H